package com.ruoyi.fetvApi.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.fetvApi.domain.FetvInformationApi;
import com.ruoyi.fetvApi.mapper.FetvInformationApiMapper;
import com.ruoyi.fetvApi.service.IFetvInformationApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 资讯Service业务层处理
 * 
 * @author zhengmingjie
 * @date 2023-02-27
 */
@Service
public class FetvInformationApiServiceImpl implements IFetvInformationApiService
{
    @Autowired
    private FetvInformationApiMapper fetvInformationApiMapper;


    /**
     * 查询资讯列表
     * 
     * @param fetvInformationApi 资讯
     * @return 资讯
     */
    @Override
    public List<FetvInformationApi> selectFetvInformationList(FetvInformationApi fetvInformationApi)
    {
        return fetvInformationApiMapper.selectFetvInformationList(fetvInformationApi);
    }


    /**
     * 点击具体新闻通过tid查询获取对应的新闻详情
     * @param informationId 资讯主键
     * @return
     */
    @Override
    public FetvInformationApi getInformationById(Integer informationId) {
        return fetvInformationApiMapper.getInformationById(informationId);
    }

    /**
     * 推荐新闻 一次性返回30条最新发布的新闻 包含标题、tid
     * @param fetvInformationApi 资讯
     * @return
     */
    @Override
    public List<FetvInformationApi> selectFetvInformationApiByThirtyInformation(FetvInformationApi fetvInformationApi) {
        return fetvInformationApiMapper.selectFetvInformationApiByThirtyInformation(fetvInformationApi);
    }

    /**
     * 最新新闻 返回今天发布的新闻对象包含标题和tid 最少为0 最多为10条
     * @param fetvInformationApi 资讯
     * @return
     */
    @Override
    public List<FetvInformationApi> selectFetvInformationApiByTodayInformation(FetvInformationApi fetvInformationApi) {
        return fetvInformationApiMapper.selectFetvInformationApiByTodayInformation(fetvInformationApi);
    }

    /**
     * 要点新闻 返回最近发布的新闻对象 包含新闻标题 新闻id 最少为0 最多为10条
     * @param fetvInformationApi 资讯
     * @return
     */
    @Override
    public List<FetvInformationApi> selectFetvInformationApiByRecentInformation(FetvInformationApi fetvInformationApi) {
        return fetvInformationApiMapper.selectFetvInformationApiByRecentInformation(fetvInformationApi);
    }

    /**
     * 根据ID返回视频
     * @param informationId 资讯主键
     * @return
     */
    @Override
    public FetvInformationApi getVideoById(Integer informationId) {
        return fetvInformationApiMapper.getVideoById(informationId);
    }

    /**
     * 根据标题模糊搜索
     * @param title 标题
     * @return
     */
    @Override
    public List<FetvInformationApi> selectFetvInformationSearch(String title) {
        return fetvInformationApiMapper.selectFetvInformationSearch(title);
    }

    /**
     * 十条推荐搜索
     * @param fetvInformationApi 资讯
     * @return
     */
    @Override
    public List<FetvInformationApi> selectFetvInformationSearchRecommend(FetvInformationApi fetvInformationApi) {
        return fetvInformationApiMapper.selectFetvInformationSearchRecommend(fetvInformationApi);
    }

    /**
     * 增加资讯浏览量
     * @param informationId 资讯主键
     */
    @Override
    public void addBrowseNum(Integer informationId) {
        fetvInformationApiMapper.updateBrowseNum(informationId);
    }
}
